package com.id.coinscleaner.game

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.id.coinscleaner.R
import com.id.coinscleaner.common.ViewBindingFragment
import com.id.coinscleaner.databinding.FragmentGameScanBinding
import com.id.coinscleaner.viewmodel.MemoryAndGameViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch


class GameScanFragment : ViewBindingFragment<FragmentGameScanBinding>() {
    val viewModel by lazy { ViewModelProvider(this.requireActivity()).get(MemoryAndGameViewModel::class.java) }
    override fun initView() {
        super.initView()
        binding.freeCompareAllRamTv.text = "${viewModel.usedStore}/${viewModel.allStore}"
        binding.usedRateTV.text = viewModel.rateStore
        binding.backIV.setOnClickListener {
            onBackPressed()
        }
    }

    override fun initEvent() {
        super.initEvent()
        lifecycleScope.launch {
            delay(3000)
            navigate(R.id.action_gameScanFragment_to_gameBoostFragment)
        }
    }
}